import QtQuick 2.0
import QtQuick.Controls 2.15

TextField {
    id: cusTextFieldRoot
    verticalAlignment: Text.AlignVCenter//垂直居中
    leftPadding: 6
    rightPadding: 6
    topPadding: 0
    bottomPadding: 0
    selectByMouse: true
    selectedTextColor: "white"
    selectionColor: "#3986FF"
    hoverEnabled: true
    color: "#4D4D4D"
    font.pixelSize: 13
    opacity: enabled ? 1 : 0.5
    property bool errorOccurs: false

    background: Rectangle {
        radius: 4
        color: "transparent"
        border.width: 1
        border.color: {
            if( errorOccurs ) { return "#E52E2E" }
            else if( cusTextFieldRoot.focus ){ return "#3986FF" }
            else if( cusTextFieldRoot.hovered ){ return "#80B0FF" }
            else { return "#D9D9D9" }
        }
    }
}

